<?php
namespace app\admin\middleware;

use think\facade\Session;


class CheckLogin
{
    protected $session;

    public function __construct(Session $session)
    {
        $this->session = $session;
//        echo 3;
//        dd($this->session);
    }


    public function handle($request, \Closure $next)
    {
//        echo 1;
//        dd(($this->session)::has('admin'));
        if (($this->session)::has('health_admin')) {
//            dd(4);
//            dd(Session::has('merchant'));
            return $next($request);
        } else {
//            dd(3);
            return redirect(url('admin/login/index'));
        }
//        return $next($request);
    }
}
